package com.example.demo.dao;

import com.example.demo.modal.BookInfo;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class BookDao {
    public List<BookInfo> mockData() {
        List<BookInfo> bookInfos = new ArrayList<>();
        for (int i = 1; i <= 15; i++) {
            BookInfo bookInfo = new BookInfo();
            bookInfo.setId(i);
            bookInfo.setAuthor("作者" + i);
            bookInfo.setBookName("书籍" + i);
            bookInfo.setCount(new Random().nextInt(20) + 5);
            bookInfo.setPrice(new BigDecimal(new Random().nextInt(70) + 10));
            bookInfo.setPublish("出版社" + i);
            bookInfo.setStatus(i % 4 == 0 ? 1 : 0);

            bookInfos.add(bookInfo);
        }
        return bookInfos;
    }
}
